<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>CSS Grid Demo</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.0/css/bulma.min.css">
    <!-- debug switch -->
    <link rel="stylesheet" href="css/debug.css">
    <link rel="stylesheet" href="css/grid.css">
</head>

<body>
    <section class="section">
        <h1 class="subtitle">网格:Grid 案例</h1>
        <div id="grid" style="padding:2rem;">
            <!-- items任意序列即可，主要是CSS（grid-template-areas）控制显示顺序和布局 -->
            <div id="e">hello 5</div>
            <div id="a">hello 1</div>
            <div id="b">hello 2</div>
            <div id="c">hello 3</div>
            <div id="d">hello 4</div>
            <!-- <div id="f">hello 5</div> -->
        </div>
    </section>
    <style>
        footer{
            width: 750px;
            min-height: 50px;
            display: grid;
            /* grid-template-columns: 20% 20% 20% 20% 20% */
            grid-template-columns: repeat(5,20%)/*同上*/
        }
        .three{
            width: 1000px;min-height: 50px;margin-top: 10px;

            display: grid;
            grid-template-columns: repeat(3,33.3%)
        }
        .threeAvg{
            width: 1000px;min-height: 50px;margin-top: 10px;

            display: grid;
            grid-template-columns: 1fr 1fr 1fr /* 1fr=calc(100%/3),段杜均分3等份*/
        }

        .tenAvg{
            width: 1000px;min-height: 50px;margin-top: 10px;

            display: grid;
            grid-template-columns: 2fr repeat(4,1fr) 3fr 1fr; /* 2+4+2+1=9份*/
            /* grid-gap: 10px; */
        }
        
    </style>
    <section class="section">
        <footer>
            <div> grid-template-columns: repeat(5,20%)</div>
            <div>width=150px</div>
            <div></div>
            <div></div>
            <div>150*5=750</div>
        </footer>

       <div class="three">
            <div>grid-template-columns: repeat(3,33.3%)</div>
            <div>width=333px</div>
            <div>333*3 != 1000,还剩1px</div>
       </div>

       <div class="threeAvg">
            <div>grid-template-columns: 1fr 1fr 1fr, 1fr=calc(100%/3),段杜均分3等份</div>
            <div>width=333.333px</div>
            <div>333.333*3 != 1000,还剩0.0001px</div>
       </div>

       <div class="tenAvg">
            <div>2fr repeat(4,1fr) 3fr 1fr</div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div>1000/(等份数),每份占n*fr</div>
            <div></div>
       </div>

    </section>

</body>

</html>